<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	version="1.0">

	<xsl:template match="/canss">
		<html>
			<head>
			</head>
			<body>
				<xsl:template match="canssContract_channelGroup">
					<!-- intro -->
					<xsl:variable name="v_pid"
							select="//canssContract_channelGroup/@id" />
					<h1>
						Channel List (
						<xsl:value-of
							select="//canssContract_channelGroup/@id" />
						님의 Contents 신청 목록)
					</h1>
					<!-- intro ends -->
					
					<!-- body -->
					<!-- 새 채널 생성 -->
					<xsl:if test="true()!=//canssContract_channel">
						생성된 채널이 없습니다.
						<form method="post"
							action="svtAjaxAddChannel">
							<input type="hidden" name="_pid"
								value="{$v_pid}" />
							<input type="hidden"
								name="_channelname" value="channel1"/>
							<input type="hidden" name="_rurl"
								value="mainframe.jsp?_pagenum=8" />
							<input type="submit" value="새 채널 생성"
								onclick="" />
						</form>
					</xsl:if>
					<!-- 새 채널 생성 ends -->
					<!-- channel iteration -->
					<xsl:for-each select="//canssContract_channel">
						<xsl:variable name="v_pid" select="@id" />
						<xsl:variable name="v_index" select="@index" />
						<xsl:variable name="v_channelname" select="canssContract_channelname"/>
						<!-- channel edit -->
						<form id="frm_revrulemanager" method="post" action="http://mediator.canss.net/MetadataManager/RevRuleManager.php" target="_blank">
							<!-- <input type="button" value='Channel "{$v_channelname}" 보기/감추기' onclick="toggle_div_showing('channel_{$v_channelname}')" />  -->
							<input type="hidden" name="_3pid" value="{$v_pid}"/>
							<input type="hidden" name="_chid" value="{$v_index}"/>
							<input type="hidden" name="_rurl" value="mainframe.jsp?_pagenum=8"/>
							<input
								onclick="var frm=getobj('frm_revrulemanager');if(!frm)return;window.open('','pop_revrulemanager','width=740,height=850');frm.target='pop_revrulemanager';frm.submit();" 
								type="button" value="내보내기 형식 관리"/>
							　　<a href="svtAjaxRemoveChannel?_pid={$v_pid}&amp;_index={$v_index}&amp;_rurl=mainframe.jsp?_pagenum=8">Channel 삭제</a>
						</form>
						<!-- channel edit ends -->
						
						<hr />
						
						<div id="channel_{$v_channelname}" style="display:block;">
							<!-- selected contents list on channel -->
							<form id="frm_RemoveCIDListOnChannel" method="POST" action="svtAjaxRemoveCIDListOnChannel">
								<input type="hidden" name="_channelname" value="{$v_channelname}" />
								<div align="left">
									<input type="submit" value="선택한 항목 삭제"/>
								</div>
								<table class="datatable">
									<tbody>
										<th scope='col'><center>번호</center></th>
										<th scope='col'>
											<input id="chk_RemoveCIDListOnChannel" type="checkbox" onclick="javascript:MarkRows_toggle('chk_RemoveCIDListOnChannel','frm_RemoveCIDListOnChannel');"/>
										</th>
										<th scope='col'>
											<center>재생</center>
										</th>
										<th scope='col'>
											<center>Title</center>
										</th>
										<th scope='col'>
											<center>설명</center>
										</th>
										<th scope='col'>
											<center>Genre</center>
										</th>
										<th scope='col'>
											<center>Thumbnail</center>
										</th>
										<th scope='col'>
											<center>Owner/Uploader</center>
										</th>
										
										
										<xsl:if test="true()!=canssContent_mediaGroup/canssContent_media">
											<tr>
												<td>-</td>
												<td>
													추가한 항목이 없습니다.
												</td>
											</tr>
										</xsl:if>
										<xsl:for-each select="canssContent_mediaGroup/canssContent_media">
											<tr>
												<td><center><xsl:number format="1"/></center></td>
												<xsl:variable name="v_src" select="xmp_Identifier" />
												<xsl:variable name="v_cid" select="canssContentDescription_contentId" />
												<xsl:variable name="v_Thumbnail" select="canssContent_Thumbnail" />
												<td>
													<!-- checkbox 자리 -->
													<input type="checkbox" name="_rm_cid_list" value="{$v_cid}"/>
												</td>
												<td class="singleentry">
													<xsl:if test="true()=xmp_Identifier/text()">
														<a onclick="window.open('testplayer/content_testview.jsp?_src={$v_src}&amp;_image={$v_Thumbnail}', 'pop_view_player', 'width=380,height=470');" 
														href="#">view</a>
													</xsl:if>
												</td>
												<td>
													<xsl:value-of select="dc_title"/>
												</td>
												<td>
													<xsl:value-of select="dc_description"/>
												</td>
												<td>
													<xsl:value-of select="xmpDM_genre"/>
												</td>
												<td class="singleentry">
													<xsl:variable name="v_thumbnail" select="canssContent_Thumbnail"/>
													<xsl:if test="true()=canssContent_Thumbnail/text()">
														<a href="{$v_thumbnail}" target="_blank"><img class="thumbnail" src="{$v_thumbnail}"/></a>
													</xsl:if>
													<xsl:if test="true()!=canssContent_Thumbnail/text()">
														-
													</xsl:if>
												</td>
												<td>
													<xsl:value-of select="canssContentDescription_owner"/>
													<xsl:if test="true()=dc_publisher/text()">
														/(<xsl:value-of select="dc_publisher"/>)
													</xsl:if>
												</td>
											</tr>
										</xsl:for-each>	
									</tbody>
								</table>
								
								<div align="left">
									<input type='hidden' name='_pid' value='{$v_pid}'/>
									<input type='hidden' name='_index' value='{$v_index}'/>
									<input type='hidden' name='_rurl' value='mainframe.jsp?_pagenum=8'/>
									<input type="submit" value="선택한 항목 삭제"/>
								</div>
							</form>
							<!-- selected contents list on channel ends -->
							<br/>
							
							<hr />
							<span>
								아래 목록은 각 컨텐츠 제공자가 현 Syndication System에 공개를 허락한 컨텐츠들을 담고 있습니다.<br/>
								이용하실 컨텐츠들을 선택하신 후 추가 버튼을 통해 사용하실 컨텐츠 목록에 추가가 가능합니다.<br/> 
							</span>
							
							<br/><br/>
							<!-- available content list -->
							<form id="frm_AddCIDListOnChannel" method="POST" action="svtAjaxAddCIDListOnChannel">
								<input type="hidden" name="_channelname" value="{$v_channelname}" />
								<div align="left">
									<input type='hidden' name='_pid' value='{$v_pid}'/>
									<input type='hidden' name='_index' value='{$v_index}'/>
									<input type='hidden' name='_rurl' value='mainframe.jsp?_pagenum=8'/>
									<input type="submit" value="선택한 항목 추가"/>
								</div>
								<table class="datatable">
									<tbody>
										<th scope='col'><center>번호</center></th>
										<th scope='col'>
											<input id="chk_AddCIDListOnChannel" type="checkbox" onclick="javascript:MarkRows_toggle('chk_AddCIDListOnChannel','frm_AddCIDListOnChannel');"/>
										</th>
										<th scope='col'>
											<center>재생</center>
										</th>
										<th scope='col'>
											<center>Title</center>
										</th>
										<th scope='col'>
											<center>설명</center>
										</th>
										<th scope='col'>
											<center>Genre</center>
										</th>
										<th scope='col'>
											<center>Thumbnail</center>
										</th>
										<th scope='col'>
											<center>Owner/Uploader</center>
										</th>
										
										<xsl:if test="true()!=//additional_inform/canssContent_media">
											<tr>
												<td>-</td>
												<td>
													이용 가능한  항목이 없습니다.
												</td>
											</tr>
										</xsl:if>
										<xsl:for-each select="//additional_inform/canssContent_media">
											<xsl:variable name="v_selected" select="selected" />
											<tr class="{$v_selected}">
												<td scope='col'>
													<center><xsl:number format="1"/></center>
												</td>	
												<xsl:variable name="v_src" select="xmp_Identifier" />
												<xsl:variable name="v_cid" select="canssContentDescription_contentId" />
												<xsl:variable name="v_Thumbnail" select="canssContent_Thumbnail" />
												<td>
													<xsl:if test="true()=selected/text()">
														<input type="checkbox" name="_add_cid_list" value="{$v_cid}" checked="checked" disabled="disabled"/>
													</xsl:if>
													<xsl:if test="true()!=selected/text()">
														<input type="checkbox" name="_add_cid_list" value="{$v_cid}"/>
													</xsl:if>
												</td>
												<td class="singleentry">
													<xsl:if test="true()=xmp_Identifier/text()">
														<a onclick="window.open('testplayer/content_testview.jsp?_src={$v_src}&amp;_image={$v_Thumbnail}', 'pop_view_player', 'width=380,height=470');" 
														href="#">view</a>
													</xsl:if>
												</td>
												<td>
													<xsl:value-of select="dc_title"/>
												</td>
												<td>
													<xsl:value-of select="dc_description"/>
												</td>
												<td>
													<xsl:value-of select="xmpDM_genre"/>
												</td>
												<td class="singleentry">
													<xsl:variable name="v_thumbnail" select="canssContent_Thumbnail"/>
													<xsl:if test="true()=canssContent_Thumbnail/text()">
														<a href="{$v_thumbnail}" target="_blank"><img class="thumbnail" src="{$v_thumbnail}" /></a>
													</xsl:if>
													<xsl:if test="true()!=canssContent_Thumbnail/text()">
														-
													</xsl:if>
												</td>
												<td>
													<xsl:value-of select="canssContentDescription_owner"/>
													<xsl:if test="true()=dc_publisher/text()">
														/(<xsl:value-of select="dc_publisher"/>)
													</xsl:if>
												</td>
											</tr>
										</xsl:for-each>
									</tbody>
								</table>
								<div align="left">
									<input type='hidden' name='_pid' value='{$v_pid}'/>
									<input type='hidden' name='_index' value='{$v_index}'/>
									<input type='hidden' name='_rurl' value='mainframe.jsp?_pagenum=8'/>
									<input type="submit" value="선택한 항목 추가"/>
								</div>
							</form>
							<!-- available content list ends -->
						</div>
					</xsl:for-each>
					<!-- channel iteration ends -->
					
					<!-- body ends -->
					
				</xsl:template>
			</body>
		</html>
	</xsl:template>

</xsl:stylesheet>